package com.xuecheng.media.listener;

import com.xuecheng.media.service.LiveCourseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * Created on 2021/04/23/23:11 周五
 *
 * @author Lantin
 */
@Slf4j
@Component
@RocketMQMessageListener(consumerGroup = "consumer-group-course-pub-main", topic = "${rocketmq.massage.topic}")
public class LiveCoursePublishListener implements RocketMQListener<Long> {

    @Autowired
    private LiveCourseService liveCourseService;

    @Override
    public void onMessage(Long message) {

        log.info("直播课程监听器收到事务消息，课程id为：{}", message);
        liveCourseService.createLiveCourseList(message);

    }
}
